#!/bin/bash

username="root"
password="123456"

dbname="hwork"

# 检查mysql中的数据库
mysql -u$username -p$password -e"create database if not exists ${dbname};"
echo "创建数据库"

#
# drop database if exists ${dbname};

# 创建表
mysql -u$username -p$password ${dbname} < /usr/homeworkSql/position_type_info_v2_DataStructure.sql
echo "创建表"

# 准备导入数据...
ls /usr/homeworkSql/SQLDumpSplitterResult/ | while read line 
    do 
        echo "文件名 ${line} 开始导入数据"
        mysql -u${username} -p${password} ${dbname} </usr/homeworkSql/SQLDumpSplitterResult/${line}

    done
echo "导入完成"